package com.caiyi.tips.user.controller;

import com.caiyi.tips.core.VO.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/*
 * @author Cliff.ZhouYang
 * @date 2017/11/14 17:15
 */
@RestController
@RequestMapping(value = "/test")
@Slf4j
@Api(value = "测试接口", tags = "1.测试", description = "项目未完全开发好提供的测试接口，例如直接查询用户短信验证码", position = 1)
public class TestController {
    @GetMapping("/yzm")
    @ApiOperation(value = "获取短信验证码", notes = "获取短信验证码")
    public ResultVO getYzmByPhone(HttpServletRequest request) {
        log.info("这里记录的是test log    test....");
        HttpSession session = request.getSession();
        session.setAttribute("rand", "123456");
        String randCode = (String) session.getAttribute("rand");
        return ResultVO.okData(randCode);
    }
}
